#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;

const int N=60;

int n,m;
int p[N];


int find(int x)
{
	if(p[x]!=x) p[x]=find(p[x]);
	return p[x];
}


int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) p[i]=i;
	
	while(m--){
		int a,b;
		scanf("%d%d",&a,&b);
		a=find(a),b=find(b);
		if(a!=b) p[a]=b;
	}
	
	int sum=1;
	for(int i=1;i<=n;i++){
		if(p[i]!=i) sum++;
	}
	
	cout<<(long long)pow(2,sum-1);
	
	return 0;
}

